<%@ page language="java" import="java.sql.*" pageEncoding="gb2312"%>
<html>
<head>
<title>图书管理系统</title>
</head>
<body background=4.jpg>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <br>
    <center>
        <div>
            <table align="center" width="80%" border=1 bgcolor="#3CC4C4">
                <tr>
                    <th>编号</th>
                    <th>书名</th>
                    <th>作者</th>
                    <th>价格</th>
               
                </tr>
                <% Connection con;
                Statement sql; //预处理语句
                ResultSet rs;
                
                try{  Class.forName("com.mysql.jdbc.Driver");
                }
                catch(Exception e){
                   out.println("忘记把MySQL数据库的JDBC-数据库驱动程序复制到JDK的扩展目录中");
                }
                String uri= "jdbc:mysql://127.0.0.1/library";
                String user="root";
                String password="";
                con=DriverManager.getConnection(uri,user,password);
                sql=con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
       
                rs=sql.executeQuery("SELECT * FROM "+"information");
            
                while(rs.next())
                {
                String bno=rs.getString(1);
                out.println("<tr><td>"+rs.getString(1)+"</td><td>《"+rs.getString(2)+"》</td><td>"+rs.getString(3)+"</td><td>"+rs.getString(4)+"</td></tr>");
                }
                rs.close();
                
                con.close();


     %>
            </table>
        </div>
        <br> <br>
        <table width="80%" bgcolor=#EEDDFF>
            <tr>
                <a href=8.jsp><font face="华文新魏" style="font-size: 20px"
                    >添加图书信息</font></a>
           
             
            </tr>
        </table>
</body>
</html>